package com.hanbang.maige.mode.javabean.quanzi;

import com.hanbang.maige.mode.javabean.base.UserData;
import com.hanbang.maige.utils.other.DateUtils;
import com.hanbang.maige.utils.other.StringUtils;

import java.util.ArrayList;
import java.util.Collections;

/**
 * 作者　　: 李坤
 * 创建时间:2016/11/1　17:31
 * 邮箱　　：496546144@qq.com
 * <p>
 * 功能介绍：
 */

public class QuanZiData {


    /**
     * rownumber : 1
     * ID : 14
     * CONTENT : 哈哈哈哈哈哈哈哈哈哈哈哈
     * friendPhoto : /upload/201611/01/big/friendquan/201611011748229739.jpg,/upload/201611/01/big/friendquan/201611011748232629.jpg
     * friendPhotoMid : /upload/201611/01/middle/friendquan/201611011748229739_Mid.jpg,/upload/201611/01/middle/friendquan/201611011748232629_Mid.jpg
     * friendPhotoSma : /upload/201611/01/small/friendquan/201611011748229739_Sma.jpg,/upload/201611/01/small/friendquan/201611011748232629_Sma.jpg
     * UserId : 5
     * orderindex : 99999
     * cjsj : /Date(1477993703440)/
     * address : 金创商务大厦
     * Showauthority : 1
     * NiChenName : mg622882
     * HeadPhoto : /upload/head.jpg
     * HeadPhotoMid : /upload/head.jpg
     * HeadPhotoSma : /upload/head.jpg
     * "dzlist": [],
     * "Isdianzan": false
     */

    private int ID;
    private String CONTENT;
    private String friendPhotoSma;
    private String friendPhotoMid;
    private int UserId;
    public String address;
    private String NiChenName;
    private String HeadPhotoMid;
    private String cjsj;
    private boolean Isdianzan;
    private ArrayList<DianZhanRen> dzlist;
    private ArrayList<PingLunData> pllist;

    public int getID() {
        return ID;
    }


    public String getCONTENT() {
        return StringUtils.dataFilter(CONTENT);
    }


    public String getFriendPhotoSma() {
        return friendPhotoSma;
    }

    public ArrayList<String> getFriendPhotoListSma() {

        if (StringUtils.isBlank(friendPhotoSma)) {
            return null;
        }
        String[] photos = friendPhotoSma.split(",");
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, photos);
        return list;
    }

    public ArrayList<String> getFriendPhotoListMid() {

        if (StringUtils.isBlank(friendPhotoMid)) {
            return null;
        }
        String[] photos = friendPhotoMid.split(",");
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, photos);
        return list;
    }


    public int getUserId() {
        return UserId;
    }


    public String getAddress() {
        return StringUtils.dataFilter(address);
    }


    public String getNiChenName() {
        return StringUtils.dataFilter(NiChenName);
    }


    public String getHeadPhotoMid() {
        return HeadPhotoMid;
    }

    public String getCjsj() {
        return DateUtils.getTime(cjsj);
    }

    public ArrayList<DianZhanRen> getDzlist() {
        return dzlist;
    }

    public ArrayList<PingLunData> getPllist() {
        return pllist;
    }

    public boolean isdianzan() {
        return Isdianzan;
    }

    public void setIsdianzan(boolean isdianzan) {
        this.Isdianzan = isdianzan;
    }

    public boolean isHaveDianzhan() {
        return dzlist != null && dzlist.size() > 0;
    }

    public boolean isHaveHuilun() {
        return pllist != null && pllist.size() > 0;
    }


    public void addUserDianZhan() {
        if (dzlist == null) {
            dzlist = new ArrayList<>();
        }
        dzlist.add(0, DianZhanRen.getUserData());
    }

    public static class DianZhanRen {
        /**
         * "dzUserId": 5,
         * "HeadPhotoSma": "/upload/head.jpg"
         */

        private int dzUserId;
        private String HeadPhotoSma;

        public int getDzUserId() {
            return dzUserId;
        }


        public String getHeadPhotoSma() {
            return HeadPhotoSma;
        }

        public static DianZhanRen getUserData() {
            if (UserData.getUserData() != null) {
                DianZhanRen dianZhanRen = new DianZhanRen();
                dianZhanRen.dzUserId = UserData.getUserData().getId();
                dianZhanRen.HeadPhotoSma = UserData.getUserData().getHeadPhotoSma();
                return dianZhanRen;
            } else {
                return null;
            }
        }


    }

    public static class PingLunData {


        /**
         * plUserIdSend : 5
         * plUserIdShou : 7
         * NiChenNameSend : mg622882
         * NiChenNameShou : mg162747
         * SendContent : 奥巴马
         * cjsj : /Date(1478057603440)/
         */

        private int plUserIdSend;
        private int plUserIdShou;
        private String NiChenNameSend;
        private String NiChenNameShou;
        private String SendContent;

        public int getPlUserIdSend() {
            return plUserIdSend;
        }

        public void setPlUserIdSend(int plUserIdSend) {
            this.plUserIdSend = plUserIdSend;
        }

        public int getPlUserIdShou() {
            return plUserIdShou;
        }

        public void setPlUserIdShou(int plUserIdShou) {
            this.plUserIdShou = plUserIdShou;
        }

        public String getNiChenNameSend() {
            return NiChenNameSend;
        }

        public void setNiChenNameSend(String NiChenNameSend) {
            this.NiChenNameSend = NiChenNameSend;
        }

        public String getNiChenNameShou() {
            return NiChenNameShou;
        }

        public void setNiChenNameShou(String NiChenNameShou) {
            this.NiChenNameShou = NiChenNameShou;
        }

        public String getSendContent() {
            return SendContent;
        }

        public void setSendContent(String SendContent) {
            this.SendContent = SendContent;
        }
    }
}
